import { INIT_OREDER, INIT_LIST } from './mutations-types.js'
export default {
    state: {
        list: [], 
        orderId: localStorage.getItem('tea_orderId') || '',
        orderList: localStorage.getItem('tea_orderList') || ''
    },
    mutations: {
        [INIT_OREDER](state, orderId) {
            state.list = orderId;
            //存储订单号
            state.orderId = orderId[0].orderId;

            // //设置一个id号
            localStorage.setItem('tea_orderId', orderId[0].orderId);
        },
        [INIT_LIST](state, orderList) {
            state.orderList = orderList;
            state.orderList = JSON.stringify(state.orderList);
            localStorage.setItem('tea_orderList', state.orderList);
        },
    }
}